﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using XukaShop.Models.Entities;

namespace XukaShop.Dao
{
    public class MessageDao
    {
        private FashionShopEntities _db = new FashionShopEntities();

        public List<Message> GetListMessage()
        {
            var selectMessage = (from message in _db.Message
                                 select message).ToList();
            return selectMessage;
        }

        /// <summary>
        /// Get a message by MessageId
        /// </summary>
        /// <param name="messageId"></param>
        /// <returns></returns>
        public Message GetMessageById(int messageId)
        {
            var selectMessage = (from message in _db.Message
                                 where message.Id == messageId
                                 select message).FirstOrDefault();
            return selectMessage;
        }
    }
}